//
//  UEPCHCommon.swift
//  Extensions
//
//  Created by gupengling on 2021/6/5.
//  Copyright © 2021 gupengling. All rights reserved.
//

import UIKit

// MARK: - 第三方头文件



// MARK: - 大小类
public let UESCREE_BOUNDS = UIScreen.main.bounds
public let UESCREE_WIDTH = UIScreen.main.bounds.width
public let UESCREE_HEIGHT = UIScreen.main.bounds.height
public let UESCREE_SCALE = UIScreen.main.scale

/// 根据不同机型尺寸的宽度
///
/// - Parameter width: 宽度
/// - Returns: 对应机型尺寸的宽度
public func KScaleWidth(width : CGFloat) -> CGFloat {
    return (UESCREE_WIDTH / 375.0) * width
}

/// 根据不同机型尺寸的高度
///
/// - Parameter height: 高度
/// - Returns: 对应机型的高度
public func KScaleHeight(height : CGFloat) -> CGFloat {
    return (UESCREE_HEIGHT / 667.0) * height
}

public let UEStatusBarHeight = UIApplication.shared.statusBarFrame.size.height
public let UENavigationBarHeight = UINavigationController().navigationBar.frame.height

/// 与导航栏对下方对齐
public let UETopLayoutGuide = UEStatusBarHeight + UENavigationBarHeight

public let UESafeTopLayoutGuide : CGFloat = {
    if #available(iOS 11.0, *) {
        return UIApplication.shared.windows.first?.safeAreaInsets.top ?? 0.0
    } else {
        return 0.0
    }
}()
/// 与导航栏上方对齐
public let UESafeBottomLayoutGuide : CGFloat = {
    if #available(iOS 11.0, *) {
        return UIApplication.shared.windows.first?.safeAreaInsets.bottom ?? 0.0
    } else {
        return 0.0
    }
}()
